import java.util.Stack;

class MyQueue232 {
     private Stack<Integer> stack1 ;
     private Stack<Integer> stack2 ;
    public MyQueue232() {
          this.stack1 = new Stack<>() ;
          this.stack2 = new Stack<>() ;
    }
    
    public void push(int x) { 
         stack1.push(x) ; 
    }
    
    public int pop() {
          if(stack1.empty() ){
           return -1 ;
          }
          while(!stack1.empty()){
            stack2.push(stack1.pop()) ; 
          }
          int tmp = stack2.pop() ;
           while(!stack2.empty()){
            stack1.push(stack2.pop()) ; 
          }
            return tmp ; 
    }
    
    public int peek() {
          if(stack1.empty() ){
           return -1 ;
          }
          while(!stack1.empty()){
            stack2.push(stack1.pop()) ; 
          }
          int tmp = stack2.peek() ;
           while(!stack2.empty()){
            stack1.push(stack2.pop()) ; 
          }
            return tmp ; 
    }
    
    public boolean empty() {
         return stack1.empty() ;
    }
}

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue obj = new MyQueue();
 * obj.push(x);
 * int param_2 = obj.pop();
 * int param_3 = obj.peek();
 * boolean param_4 = obj.empty();
 */